package com.renjian.funplaypro.model;

import cn.hutool.crypto.SecureUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

@TableName("zw_user")
@Getter
@Setter
@ToString
public class User {
    @TableId(value = "id",type = IdType.AUTO)
    private Long id;
    private String username;
    private String password;
    @TableField("email")
    private String usermail;

    private String nickname;

    @TableField(exist = false)
    public static final String anotherStr="mkdir renjian";

    public boolean compareEqualsBySecurePass(User user){
        return password.equals(SecureUtil.md5(user.getPassword()+anotherStr));
    }

    public void setSecurePassword(){
        password = SecureUtil.md5(password+anotherStr);
    }
}
